package scala.objectoriented

object exentsTest1 {
  def main(args: Array[String]): Unit = {
    val teach1 = new PersonOne();
    println(teach1.name)
    teach1.hello();

    val teach2: PersonOne = new PersonOne();
    println(teach2.name)
    teach2.hello();
  }

  class Person{
    val name : String = "父类"

    def hello() : Unit={
      println("hello Person")
    }
  }

  class PersonOne extends Person {

    override val name: String = "历史老师"

    override def hello(): Unit = {
      println("你好"+name)
    }

  }
}
